﻿using System.Data.Entity.ModelConfiguration;

namespace HobSoft.SoccerBet2014.Domain.Models.DbSchema
{
    public class GameConfiguration : EntityTypeConfiguration<Game>
    {
        public GameConfiguration(string schema = "dbo")
        {
            ToTable(schema + ".MatchList");
            HasKey(g => new { g.BmID, g.GameID });
            Property(g => g.BmID).HasColumnName("BookerID").IsRequired();
            Property(g => g.GameID).HasColumnName("MatchID").IsRequired().HasMaxLength(50).IsUnicode(false);
            Property(g => g.GameCode).HasColumnName("MatchCode").IsRequired().HasMaxLength(50).IsUnicode(false);
            Property(g => g.HomeTeam).HasColumnName("HTeamName").IsRequired().HasMaxLength(50);
            Property(g => g.AwayTeam).HasColumnName("VTeamName").IsRequired().HasMaxLength(50);
            Property(g => g.Tournament).HasColumnName("LeagueName").IsRequired().HasMaxLength(100);
            Property(g => g.TournamentID).HasColumnName("LeagueID").IsRequired().HasMaxLength(20).IsUnicode(false);
            Property(g => g.HomeScore).HasColumnName("HScore").IsRequired();
            Property(g => g.AwayScore).HasColumnName("VScore").IsRequired();
            Property(g => g.HomeRed).HasColumnName("HRed").IsOptional();
            Property(g => g.AwayRed).HasColumnName("VRed").IsOptional();
            Property(g => g.StartTime).HasColumnName("MatchTime").IsOptional();
            Property(g => g.State).HasColumnName("MatchStatus").IsRequired().HasColumnType("tinyint");
            Property(g => g.PlayeTime).HasColumnName("DisplayTimeState").IsOptional().HasMaxLength(20).IsUnicode(false);
            Property(g => g.PlayMinutes).HasColumnName("PlayMinutes").IsOptional();
            Property(g => g.InjuryMinutes).HasColumnName("InjuryMinutes").IsOptional();
            Property(g => g.Pried).HasColumnName("Pried").IsOptional();
            Property(g => g.LastUpdateTime).HasColumnName("LastUpdateTime").IsOptional();
            Property(g => g.LastUpdateHost).HasColumnName("LastUpdateHost").IsOptional().HasMaxLength(200).IsUnicode(false);
            Ignore(g => g.Key);
            Ignore(g => g.RawJson);
        }
    }
}
